package com.atguigu.gmall.item.pool;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 自定义多线程池
 */
@Configuration
public class ThreadPoolConfig {


    //自定义多线程池
    @Bean
    public ThreadPoolExecutor threadPoolExecutor(){
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
                5,100,10, TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(1000));
        return threadPoolExecutor;
    }

}
